SET(TARGET_NAME ExeCommon)
#PROJECT(${TARGET_NAME})
#必须要有的宏定义
#ADD_DEFINITIONS (-DLIB_OSG_EXPORT)

if(APPLE)
    #set(CMAKE_CXX_STANDARD 11)
    #set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

if(APPLE)
    #set(CMAKE_CXX_STANDARD 11)
    #set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
# set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -g”)


#INCLUDE_DIRECTORIES("..\\..\\include")
#LINK_DIRECTORIES("..\\..\\lib")
IF (CMAKE_CL_64)
ELSE()
ENDIF()
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include)
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME})
    INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/LibCommon)
    INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/LibIk)
    INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/PluginDefault)
	LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/lib)
    LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/LibCommon)
    LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/LibIk)
	LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/lib/plugin)
	LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/lib/plugind)
	
    # INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR})
    # LINK_DIRECTORIES(${OSG_LIB_DIR})

    # INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
    # INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}/QtCore)
    # LINK_DIRECTORIES(${QT_LIB_DIR})

    INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/LibOsg)
    INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/LibBody)
    LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)

ADD_DEFINITIONS (${Qt5Widgets_DEFINITIONS})
#库文件在debug下名字后面加d
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")

FILE(GLOB_RECURSE ThisTarget_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.h")
FILE(GLOB_RECURSE ThisTarget_SRC_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.cpp")

source_group("include" FILES ${ThisTarget_INCLUDE_LIST})
source_group("src" FILES ${ThisTarget_SRC_LIST})

ADD_EXECUTABLE(${TARGET_NAME} ${ThisTarget_SRC_LIST} ${ThisTarget_INCLUDE_LIST} )

add_dependencies(${TARGET_NAME} LibCommon)
add_dependencies(${TARGET_NAME} LibIk)

    SET(ADDITIONAL_LIBRARIES_RELEASE
        # osg
        LibCommon
        # LibIk
        # PluginDefault
		# Qt5Core
    )
    SET(ADDITIONAL_LIBRARIES_DEBUG
        # osgd
        LibCommond
        # LibIkd
        # PluginDefaultd
		# Qt5Cored
    )



TARGET_LINK_LIBRARIES(${TARGET_NAME} debug "${ADDITIONAL_LIBRARIES_DEBUG}" optimized "${ADDITIONAL_LIBRARIES_RELEASE}")
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PROJECT_BINARY_DIR}/bin)

#set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE /ENTRY:mainCRTStartup")# WINDOWS

#设置vs的调试环境
set(DEBUG_ENVI "PATH=" 
                ${OSG_BIN_DIR}
   ${PROJECT_BINARY_DIR}/plugind
                "%PATH%"
                )
set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_ENVIRONMENT "${DEBUG_ENVI}")
set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")



